<%@ page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>
<%
	String id = (String) request.getAttribute("id");

%>
<html>
<head>


<script type="text/javascript">
var id=<%=id%>;
var listPageUrl="family/index.do";
var FamilyInfoUrl="rest/family/info.do";
var updateFamilyUrl="rest/family/update.do";

$(document).ready(function () {	
	
	var villageJson=syncGetDictListByTypeName('village');
	console.log(villageJson);
	
	$('#village').combobox({
        data: villageJson,
        valueField: 'dictValue',
        textField: 'dictName',
        onLoadSuccess: function(param){
  		}
        
  	}); 

		$.get(FamilyInfoUrl + "?id=" + id, function(result) {
			if (result.retCode == "0000") {
				data = result.data;
				$('#Family-fm').form('load', data);
				
			} else {
				$.messager.alert('操作提示', "加装数据失败", '加装数据失败');
			}
		});
		


	})
	//end ready
	
	function updateFamily() {
		$('#Family-fm').form('submit', {
			url : updateFamilyUrl,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(result) {
				var result = eval('(' + result + ')');
				if (result.retCode == '0000') {
					back(listPageUrl);
				} else {
					$.messager.alert("提示",result.retMsg);
				}
			}
		});
	}

	function back(url) {
		$.get(url, {}, function(data) {
			$("#center").empty();
			$("#center").html(data);
			$.parser.parse($("#center"));
		});
	}
</script>
</head>
<body>
		
<div class="linkbar"><a>人脸识别</a>/<a>人脸库管理</a>/<a>编辑</a></div>
<!-- 		<div class="breadcrumb">系统 &gt;&gt; 用户管理 &gt;&gt; 编辑用户</div> -->
		<div id="Family-edit" 	buttons="#Family-edit-buttons">
			<form id="Family-fm" method="post" novalidate>
				<INPUT TYPE=hidden NAME=id VALUE="${id}">
				<div class="fitem">
					<label>户名:</label> <input name="name"
						class="easyui-validatebox" missingMessage="该输入项不能为空！"
						required="true" />
				</div>
	
				<div class="fitem">
					<label>户主名:</label> <input name="masterName"
						class="easyui-validatebox" missingMessage="该输入项不能为空！"
						required="true" />
				</div>
				<div class="fitem">
					<label>村:</label> 
					<select id="village" name="village" class="easyui-combobox" style="width:100px" >
					</select> 
				</div>
				
				<div class="fitem">
					<label>联系电话:</label> <input name="phone"
						class="easyui-validatebox" missingMessage="该输入项不能为空！"
						required="true" validType="mobile" />
				</div>
				
				<div class="fitem">
					<label>电机编号:</label> <input name="meterNo"
						class="easyui-validatebox" missingMessage="该输入项不能为空！"
						required="true" />
				</div>
				
				<div class="fitem">
					<label>安装时间:</label> 
					<input id="registeredTime" name="registeredTime" type="text" class="easyui-datebox" required="required">
					
				</div>
			
			

			
					
			</form>
		</div>
		<div id="dlg-buttons">
			<a href="#" class="easyui-linkbutton" iconCls="icon-ok" 	onclick="updateFamily()">保存</a> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="back(listPageUrl)">返回</a>
		</div>
		

</body>
</html>